package views;

import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class Open 
{
	private static final long serialVersionUID = 1L;

	private JFrame jFrame = null;  //  @jve:decl-index=0:visual-constraint="10,10"

	private JPanel jContentPane = null;

	private JLabel headingLabel = null;
	
	private JLabel headingLabel_2 = null;
	
	private JList projectList_1 = null;
	
	private JScrollPane scrollPane = null;
	
	private JButton openButton = null;
	
	private JButton cancelButton = null;
	
	public Open()
	{
		getJFrame().setVisible(true);
	}
	
	private JFrame getJFrame() 
	{
		if (jFrame == null) 
		{
			jFrame = new JFrame();
			jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			jFrame.setSize(380, 400);
			jFrame.setContentPane(getJContentPane());
			jFrame.setTitle("Open Existing Project");
			jFrame.setLocationRelativeTo(null);
		}
		return jFrame;
	}
	
	private JPanel getJContentPane() 
	{
		if (jContentPane == null) 
		{
			headingLabel = new JLabel();
			headingLabel.setBounds(new Rectangle(10, 10, 400, 20));
			headingLabel.setText("Please select from the list below to open your project.");
			
			headingLabel_2 = new JLabel();
			headingLabel_2.setBounds(new Rectangle(10, 40, 400, 20));
			headingLabel_2.setText("Existing Projects:");
			
			projectList_1 = new JList();
			projectList_1.setBounds(10, 100, 300, 200);
			
			scrollPane = new JScrollPane (projectList_1);
			scrollPane.setBounds(10, 100, 350, 200);
			
			openButton = new JButton();
			openButton.setText("Open");
			openButton.setBounds(180, 320, 80, 30);
			openButton.addActionListener(new ActionListener()
			{
				public void actionPerformed(ActionEvent e) 
				{
					JOptionPane.showMessageDialog(null, "Open Button");
				}	
			});
			
			cancelButton = new JButton();
			cancelButton.setText("Cancel");
			cancelButton.setBounds(280, 320, 80, 30);
			cancelButton.addActionListener(new ActionListener()
			{
				public void actionPerformed(ActionEvent e) 
				{
					cancelWindow();
				}	
			});
			
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(headingLabel, null);
			jContentPane.add(headingLabel_2, null);
			jContentPane.add(scrollPane);
			jContentPane.add(openButton);
			jContentPane.add(cancelButton);
		}
		return jContentPane;
	}
	
	private void cancelWindow()
	{
		jFrame.setVisible(false);
		jFrame.dispose();
	}
}
